<template>
  <div>
    <div class="body">
      <div class="header">
        <van-nav-bar
          title="市容顽症事件发现"
          left-text=""
          left-arrow
          @click-left="onClickLeft"
        />
        <div class="eventnum">{{ eventnum }}</div>
      </div>
      <div class="sub">
        <router-link to="/eventDiscoveryMain/manualReport">
          <div class="sub-item rgsb">
            <span>人工上报</span>
            <i></i>
          </div>
        </router-link>
        <router-link to="/eventDiscoveryMain/eventAIlist">
          <div class="sub-item aisb">
            <span>AI自动识别</span>
            <i></i>
          </div>
        </router-link>
      </div>
    </div>
  </div>
</template>

<script>
import { disGetCount } from '../../../utils/api'
export default {
  name: "eventDiscovery",
  data() {
    return {
      eventnum: 61,
    };
  },
  mounted () {
    disGetCount().then((res)=>{
      if(res.code === 200 && res.data.aiEventCount){
        this.eventnum = res.data.aiEventCount + res.data.personEventCount
      }else{
          Toast.fail(res.message)
        }
    })
  },
  methods: {
    onClickLeft() {
      this.$router.push({ path: "/" });
    },
  },
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.body {
  width: 100%;
  height: 100vh;
  background: #fff;
}
.header {
  width: 100%;
  height: 350px;
  background-image: url("~@/assets/img/eventDiscovery/eventDiscovery.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  position: relative;
}
.sub {
  width: 90%;
  height: 215px;
  margin: auto;
  margin-top: 100px;
  overflow: hidden;
}
.sub-item {
  width: 48%;
  height: 90px;
  float: left;
  margin: 2% 1% 0px 1%;
  text-align: left;
  padding: 10px 20px;
  box-sizing: border-box;
  position: relative;
  color: #fff;
  border-radius: 8px;
  font-weight: bold;
}
.rgsb {
  background: linear-gradient(-55deg, #5594ff 0%, #73cdff 100%);
}
.aisb {
  background: linear-gradient(-55deg, #ff645f 0%, #ff9a67 100%);
}
.sub-item i {
  position: absolute;
  width: 55px;
  height: 55px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  right: 20px;
  top: 16px;
}
.rgsb i {
  background-image: url("~@/assets/img/eventDiscovery/rgsb.png");
}
.aisb i {
  background-image: url("~@/assets/img/eventDiscovery/aisb.png");
}
.eventnum {
  width: 130px;
  height: 130px;
  background-image: url("~@/assets/img/eventDiscovery/eventnum.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  margin: auto;
  margin-top: 70px;
  line-height: 130px;
  text-align: center;
  font-weight: bold;
  font-size: 55px;
  color: #fff;
}
</style>
